
#ifndef __DEVICE_H__
#define __DEVICE_H__

typedef enum {
#if CONFIG_GPIO
    DEV_CLASS_GPIO,
#endif
#if CONFIG_UART
    DEV_CLASS_UART,
#endif
#if CONFIG_SPI
    DEV_CLASS_SPI,
#endif
#if CONFIG_FLASH
    DEV_CLASS_FLASH,
#endif
    DEV_CLASS_MAX
} dev_class_e;

typedef struct
{
	dev_class_e class;
	char *name;
    int port;
    int handle;
} devItem_t;

#define __dev __attribute__((unused, section(".devRegTable")))
#define dev_export(class, name, port) devItem_t _devItem_##class##_##port __dev = {class, name, port, 0}

extern int device_init(void);
extern int device_find_by_name(char *name);
extern int device_find_by_class_port(dev_class_e class, int port);

#endif
